package com.wyh.filemanager.model;

import android.annotation.SuppressLint;
import java.util.Hashtable;

import com.wyh.log.MyLog;

public class SelectionHelp {

	private static final String TAG = "SelectionHelp";

	private static SelectionHelp mInstanse;

	public static SelectionHelp getInstanse() {
		if (mInstanse == null) {
			mInstanse = new SelectionHelp();
		}
		return mInstanse;
	}

	private SelectionHelp() {
		MyLog.debug(TAG, "SelectionHelp");
	}

	private Hashtable<String, Integer> mSelections = new Hashtable<String, Integer>();

	@SuppressLint("UseValueOf")
	public void addSeletion(String path, int selection) {
		if (path == null)
			return;
		if (mSelections.containsKey(path)) {
			mSelections.remove(path);
		}
		mSelections.put(path, new Integer(selection));
	}

	public void deleteSelection(String path) {
		if (path == null)
			return;
		mSelections.remove(path);
	}

	public int getSelection(String path) {
		if (path == null)
			return -1;
		if (mSelections.containsKey(path)) {
			return mSelections.get(path).intValue();
		}
		return 0;
	}

}
